<?php

namespace catchAdmin\pc\tables;

use catchAdmin\pc\tables\forms\Factory;
use catcher\CatchTable;
use catcher\library\table\Actions;
use catcher\library\table\HeaderItem;
use catcher\library\table\Search;

class WechatUserBalance extends CatchTable
{

    public function Table()
    {
        return $this->getTable('wechatUserBalance')
            ->header([
                HeaderItem::label('公司名')->prop('wechat_user_company_name'),
                HeaderItem::label('金额')->prop('num'),
                HeaderItem::label('类型')->prop('balance_type_2_name'),
                HeaderItem::label('时间')->prop('created_at'),
//                HeaderItem::label('操作')
//                    ->actions([
////                        Actions::update(),
////                    Actions::delete(),
//                        Actions::normal('查看详情', 'zz3', 'tongguoshenhe', 'el-icon-s-tools'),
//
//                    ])
//                    ->width(120),
            ])
            ->withSearch([
                Search::label('公司名')->text('wechat_user_company_name', '公司名')->style(['width' => '150px'])
                    ->clearable(true),
                Search::label('类型')
                    ->select('balance_type_2', '选择类型', tableSelectArray((new \catchAdmin\model\WechatUserBalance())->getBalanceType2NameBalanceList()))
                    ->style(['width' => '100px'])
                    ->clearable(true),
            ])
            ->selectionChange()
            ->withApiRoute('wechatUserBalance')
            ->withActions([
//                Actions::create(),
//                Actions::export(),
            ])
            ->render();
    }


    public function form()
    {
        return Factory::create('wechatUserBalance');
    }

}
